<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="项目工作量汇总" name="first"><tl-task-log-project ref="taskLogProject"></tl-task-log-project></el-tab-pane>
      <el-tab-pane label="部门工作量汇总" name="second"><tl-task-log-dept ref="taskLogDept"></tl-task-log-dept></el-tab-pane>
      <el-tab-pane label="人员工作量汇总" name="third"><tl-task-log-person ref="taskLogPerson"></tl-task-log-person></el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
/** 子组件 */
import tlTaskLogProject from './taskLogProject.vue'
import tlTaskLogDept from './taskLogDept.vue'
import tlTaskLogPerson from './taskLogPerson.vue'
export default {
  name: 'pmTaskLogStatistics',
  components: { tlTaskLogProject, tlTaskLogDept, tlTaskLogPerson },
  data() {
    return {
      activeName: 'first'
    }
  },
  methods: {
    handleClick(tab, event) {
      if (tab.name === 'first') {
        this.$refs.taskLogProject.doQuery()
      } else if (tab.name === 'second') {
        this.$nextTick((_) => {
          this.$refs.taskLogDept.doQuery()
        })
      } else if (tab.name === 'third') {
        this.$nextTick((_) => {
          this.$refs.taskLogPerson.doQuery()
        })
      }
    }
  }
}
</script>

<style scoped></style>
